<?php
	// 加载公共文件		
	include_once('../public/config/sql.php');

	// 实例化对象
	$obj = new sql($info);

	// 接收关键字key
	$key = isset($_POST['key']) ? $_POST['key'] : '';

	// 分页信息
	$sql = "select count(*) AS aggregate from users";

	if(strlen($key) > 0){

		$sql .= " where concat(name,username) like ?";
	}

	$count    =  $obj->db_select_count($sql, $key);
	$maxPage  =  ceil($count / $pagesize);
	$page     =  max($page, $minPage);
	$page     =  min($page, $maxPage);
	$total    =  ($page - 1) * $pagesize;

	// 构建SQL语句，发送执行
	$sql = "select id,img,name,username,email,content,state from users";

	if(strlen($key) > 0){

		$sql .= " where concat(name,username) like ?";
	}
	$sql .= " order by id desc limit ?,?";

	$articleList = $obj->db_select($sql, true, $key, $total, $pagesize);
?>